package com.mach.platform.sprider.dev.virdev;

import com.mach.platform.sprider.getter.GeneralDev;

import java.io.IOException;
import java.util.Map;

public class GeneralDevCtx implements GeneralDev {

    public final GeneralDev dev;
    public Integer runCnt = 0;
    public Integer runTime = 0;

    public Integer devIx = null;

    public GeneralDevCtx(GeneralDev dev){
        this.dev = dev;
    }
    public GeneralDevCtx(GeneralDev dev, Integer devIx){
        this.dev = dev;
        this.devIx = devIx;
    }

    @Override
    public void start() {
        this.dev.start();
    }

    @Override
    public void cmd(Integer cmdLogId, String cmd, String param) {
        this.dev.cmd(cmdLogId,  cmd,  param);
    }

    @Override
    public void updateDevInfo(Map<String, Object> devInfo) {
        this.dev.updateDevInfo(devInfo);
    }

    @Override
    public Object getValueByColl(Map<String, Object> coll) throws IOException {
        return this.getValueByColl(coll);
    }

    @Override
    public Object getValueByCollName(String collName) throws IOException {
        return this.getValueByCollName(collName);
    }

    @Override
    public Map<String, Object> getCollByName(String collName) {
        return this.getCollByName(collName);
    }

    @Override
    public Integer getDevId() {
        return this.dev.getDevId();
    }

    @Override
    public void run() {
        this.dev.run();
    }
}
